using UnityEngine;

public class CornerCollision : MonoBehaviour
{
	[SerializeField]
	private PocketTrigger m_TargetPocket;

	[SerializeField]
	private float m_Strength;

	public void OnCollisionEnter(Collision collision)
	{
		if (collision.gameObject.CompareTag("Ball"))
		{
			Rigidbody rigidbody = collision.rigidbody;
			if (!rigidbody.isKinematic)
			{
				Vector3 velocity = rigidbody.velocity;
				Vector3 b = (m_TargetPocket.transform.position - collision.transform.position).normalized * m_Strength;
				rigidbody.velocity = (velocity + b).normalized * velocity.magnitude;
			}
		}
	}
}
